#ifndef __MAX7219_TRANSFER_H__
#define __MAX7219_TRANSFER_H__

#include <driver/spi_master.h>
#include <stdbool.h>
#include "esp_log.h"

#define MAX7219_MAX_BRIGHTNESS   15

typedef struct 
{
    // must be assign for public
    uint8_t mosi_pin;
    uint8_t cs_pin;
    uint8_t clk_pin;
    uint8_t cascade_size;
    spi_host_device_t used_spi_id;
    void * matrix_buffer;

    // interonal use
    spi_device_handle_t spi_dev;
    bool bcd;
}max7219_tranfer;


esp_err_t tranfer_init(max7219_tranfer * handle);
esp_err_t transfer_send_buffer(max7219_tranfer * handle);
esp_err_t transfer_send_buffer_custom(max7219_tranfer * handle, void * buffer);
esp_err_t transfer_set_brightness(max7219_tranfer *handle, uint8_t value);

#endif